package org.ch00.test11.demo01;

/*
 *
 *@author XCH
 *@date 2025 - 03 - 11 - 20:09
 *
 */
public class CinemaThread extends Thread{
    private int ticketCount = 50; // 每个线程卖50张票

    @Override
    public void run() {
        while (ticketCount > 0) {
            System.out.println(Thread.currentThread().getName() + " 卖出第 " + (50 - ticketCount + 1) + " 张票");
            ticketCount--;
        }
        System.out.println(Thread.currentThread().getName() + " 票已售罄");
    }
}
